/**
 * @file    dev_afe.h
 * @brief   设备驱动-模拟前端初始化
 * @author  Liuwei
 * @version 1.0.1
 * @date    2023-04-26
 * 
 * @copyright Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version   <th>Author   <th>Description
 * <tr><td>2023-04-26 <td>1.0.1     <td>Liuwei   <td>首次创建
 * </table>
 */

#ifndef __DEV_AFE_H_
#define __DEV_AFE_H_

/* file includes -------------------------------------------------------------*/
#include <stdint.h>
/* cplusplus -----------------------------------------------------------------*/
#ifdef __cplusplus
extern "C" {
#endif

/* macro/define/typedef ------------------------------------------------------*/
#include "OZ7717.h"
/* variables -----------------------------------------------------------------*/

/*******************************************************************************
 * public API List
 ******************************************************************************/
void dev_afe_init(uint8_t cell_num);
uint8_t dev_afe_read_volt(uint16_t *volt_buf , uint8_t size);
uint8_t dev_afe_read_alarm(afe_alm_type *alarm_msg);
uint8_t dev_afe_ctrl_mos(uint8_t cmos ,uint8_t dmos);
uint8_t dev_afe_clr_sc_alarm(void);
uint8_t dev_afe_clr_alarm(void);
uint8_t dev_afe_get_mos_state(uint8_t *cmos, uint8_t *dmos);
uint8_t dev_afe_ctrl_balance(uint16_t set_val , uint8_t cell_num);
uint8_t dev_afe_read_status(void);
uint8_t dev_afe_read_comm_state(void);
uint8_t dev_afe_cadc_ready(void);
uint8_t dev_afe_read_coulom_volt(double *curr);
uint8_t dev_afe_read_packc_volt(double *curr);
uint8_t dev_afe_read_sc_alarm(void);
void dev_afe_into_sleep(void);
uint8_t dev_afe_curr_read(void);
uint8_t dev_afe_get_sc_curr_dly(uint16_t *curr , uint16_t *dly);

#ifdef __cplusplus
}
#endif

#endif  /* #ifndef __DEV_AFE_H_ */
/********** Copyright (c) 2023 JBD-Energy Storage Technology Co. LTD *********/
